package com.labofjet.jpa.bean;

import java.util.List;
import java.util.Map;

/**
 * 执行原生SQL用的仓库
 * 
 * @author jyzjyz12@163.com
 * 
 */
@SuppressWarnings("rawtypes")
public interface NativeSQLRepository {
	/**
	 * 执行Named Query,返回单个查询结果
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	Object querySingleByNamedQuery(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行Named Query查询,返回List结果,2维List
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	List queryListByNamedQuery(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行Named Query查询,返回List结果,每个结果都是Map
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	List queryMapByNamedQuery(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行NamedQuery查询,返回对象List
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	<T> List<T> queryListByNamedQuery(String namedQuery, Map<String, Object> paramMap, Class<T> targetClass);

	/**
	 * 执行更新,删除等,返回影响行数
	 * 
	 * @param sql
	 * @param paramMap
	 */
	int exec(String sql, Map<String, Object> paramMap);

	/**
	 * 执行Query,返回单个查询结果
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	Object querySingle(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行Query查询,返回List结果,2维List
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	List queryList(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行Query查询,返回List结果,每个结果都是Map
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	List queryMap(String namedQuery, Map<String, Object> paramMap);

	/**
	 * 执行查询,返回对象List
	 * 
	 * @param namedQuery
	 * @param paramMap
	 * @return
	 */
	<T> List<T> queryList(String namedQuery, Map<String, Object> paramMap, Class<T> targetClass);

}
